package com.be.beadmin.generator.controller;


import com.be.beadmin.common.utils.ResultModel;
import com.be.beadmin.generator.entity.ColumnInfo;
import com.be.beadmin.generator.entity.GenConfig;
import com.be.beadmin.generator.service.GenConfigService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
public class GenConfigController {

    @Autowired
    private  GenConfigService genConfigService;


    @PostMapping(value = "/generator/genConfig")
    public ResultModel genConfig(@RequestBody String tableName){
        return ResultModel.success(genConfigService.find(tableName));
    }

    @PostMapping(value = "/generator/updateConfig")
    public ResultModel updateGenConfig(@Validated @RequestBody GenConfig genConfig){
        return ResultModel.success(genConfigService.update(genConfig.getTableName(), genConfig));
    }




}
